package com.sunyur.tailor.channel.web.outer.purchase.dto;


import com.sunyur.tailor.channel.service.inner.workflow.param.Instance;
import org.hibernate.validator.constraints.Range;

import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.List;

/**
 * @description: 工作流同步审批进度参数
 * @author: wjh
 * @time: 2021/05/10 0023 19:23
 */
public class WorkFlowSyncTaskDTO implements Serializable {

    private static final long serialVersionUID = 7442358491492477705L;

    //审批信息
    @Valid
    @NotNull(message = "费用类型集合不能为空")
    private Instance instance;
    //审批完成进度
    @Valid
    private List<Task> completedTasks;
    //待审批的进度
    @Valid
    private List<Task> pendingTasks;


    /**
     * 流程进度对象
     */
    public static class Task implements Serializable {
        /**
         * 任务唯一的标识(如果没有,可用UUID)
         */
        @NotEmpty(message = "任务唯一的标识不能为空")
        @Size(max = 64, message = "任务唯一的标识长度不能超过64")
        private String taskId;
        /**
         * 任务名称
         */
        @NotEmpty(message = "任务名称不能为空")
        @Size(max = 45, message = "任务名称长度不能超过45")
        private String nodeName;
        /**
         * 审批人工号
         */
        @NotEmpty(message = "审批人工号不能为空")
        @Size(max = 64, message = "审批人工号长度不能超过64")
        private String approverCode;
        /**
         * 审批人姓名
         */
        @NotEmpty(message = "审批人姓名不能为空")
        @Size(max = 255, message = "审批人姓名长度不能超过255")
        private String approverName;
        /**
         * 处理状态 1:通过，2:驳回 3:撤回 4:异常
         */
        @NotNull(message = "处理状态不能为空")
        @Range(max = 4, min = 1, message = "处理状态不在1~4范围内")
        private Integer processStatus;
        /**
         * 任务状态 0 进行中/1 已完成
         */
        @NotNull(message = "任务状态不能为空")
        @Range(max = 1, min = 0, message = "任务状态不在0~1范围内")
        private Integer taskStatus;
        /**
         * 审批意见
         */
        @NotEmpty(message = "审批意见不能为空")
        @Size(max = 255, message = "审批意见长度不能超过255")
        private String comment;
        /**
         * 处理时间
         */
        @NotNull(message = "处理时间不能为空")
        private Long processTime;

        public String getTaskId() {
            return taskId;
        }

        public void setTaskId(String taskId) {
            this.taskId = taskId;
        }

        public String getNodeName() {
            return nodeName;
        }

        public void setNodeName(String nodeName) {
            this.nodeName = nodeName;
        }


        public String getApproverCode() {
            return approverCode;
        }

        public void setApproverCode(String approverCode) {
            this.approverCode = approverCode;
        }

        public String getApproverName() {
            return approverName;
        }

        public void setApproverName(String approverName) {
            this.approverName = approverName;
        }

        public Integer getProcessStatus() {
            return processStatus;
        }

        public void setProcessStatus(Integer processStatus) {
            this.processStatus = processStatus;
        }

        public String getComment() {
            return comment;
        }

        public void setComment(String comment) {
            this.comment = comment;
        }

        public Long getProcessTime() {
            return processTime;
        }

        public void setProcessTime(Long processTime) {
            this.processTime = processTime;
        }

        public Integer getTaskStatus() {
            return taskStatus;
        }

        public void setTaskStatus(Integer taskStatus) {
            this.taskStatus = taskStatus;
        }

    }

    public Instance getInstance() {
        return instance;
    }

    public void setInstance(Instance instance) {
        this.instance = instance;
    }

    public List<Task> getCompletedTasks() {
        return completedTasks;
    }

    public void setCompletedTasks(List<Task> completedTasks) {
        this.completedTasks = completedTasks;
    }

    public List<Task> getPendingTasks() {
        return pendingTasks;
    }

    public void setPendingTasks(List<Task> pendingTasks) {
        this.pendingTasks = pendingTasks;
    }
}